package com.hourse.platform.vo;

import com.alibaba.fastjson.JSONObject;
import com.hourse.platform.exception.ValidateException;
import com.hourse.platform.utils.BeanTools;
import lombok.Data;

import java.beans.Transient;
import java.io.Serializable;

/**
 * @使用描述: BaseBean
 */
@Data
public class BaseVo implements Serializable {

  /**
   * 当前实例转其他实例
   * @param clzss
   * @return
   */
  @Transient
  public Object bindEnity(Class clzss) throws ValidateException {

    return BeanTools.BindEnity(this,clzss);
  }

  @Transient
  public Object bindEnityUnValidate(Class clzss){

    return BeanTools.BindEnityUnValidate(this,clzss);
  }

  @Transient
  public JSONObject toJson(){

    return BeanTools.ToJson(this);
  }

  public PageData SUCCESS(){

    return PageData.New().SUCCESS(this);
  }

  public PageData SUCCESS(Object data){

    return PageData.New().SUCCESS(data);
  }

  public PageData SUCCESS(Object data,String msg){

    return PageData.New().SUCCESS(data,msg);
  }

//  public PageData ERROR(ErrorMsg errorMsg){
//
//    return errorMsg.Build();
//  }
}
